#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL k;
int main(){
    cin>>k;
    LL ans = 0;
    for(int i = 1; i <= 1e7; i++){
        ans = ans * 10 + 7;
        if(ans % k == 0) {
            cout<<i<<endl;
            return 0;
        }
        ans %= k;
    }
    cout<<"-1"<<endl;
    return 0;
}